package J1_5;

import java.util.Scanner;

public class J105task2 {
    public static void main(String[] args) {
        int n;
        boolean f;
        Scanner scanner =new Scanner(System.in);
        System.out.print("输入一个整数:");
        n=scanner.nextInt();
        f=suShu(n);
        if (f)
            System.out.println(n+"是素数");
        else
            System.out.println(n+"不是素数");
    }
    private  static  boolean suShu(int n){
        boolean b=false;
        double x=0;
        x=Math.sqrt(n);
        for (int i=2;i<=x;i++){
            if (n%i==0){
                b=false;
                break;
            }
            else {
                b=true;
            }
        }
        return  b;
    }
}
